package com.backend.system.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 启用/禁用状态枚举
 *
 * @author backend-manage
 */
@Getter
@AllArgsConstructor
public enum EnableStatusEnum {

    ENABLE(1, "启用"),
    DISABLE(2, "禁用");

    @EnumValue
    private final Integer code;

    private final String desc;

    public static EnableStatusEnum getInstance(Integer code) {
        return Arrays.stream(EnableStatusEnum.values()).filter(t -> t.getCode().equals(code)).findAny().orElse(null);
    }
}
